public class Test2 {
    static final int P = 50 ;
    public static void main(String[] args) {
        Thread a = new Thread(){
            public void run() {
                for (int i = 0; i < P; i++) {
                    if(i%2==0) System.out.println(i);
                }
            };           
        };
        Runnable bb = new Runnable() {
            @Override
            public void run() {
                 for (int i = 0; i < P; i++) {
                    if(i%2!=0) System.out.println(i);
                }
            }
        };
        Thread b =new Thread(bb);
        a.start();
        b.start();
    }

}
